/*
 * @Author: sympsel sympsel@outlook.com
 * @Date: 2025-07-25 14:09:54
 * @LastEditors: sympsel sympsel@outlook.com
 * @LastEditTime: 2025-07-25 14:27:48
 * @FilePath: \work25_7_24d:\Code\vsCode\universal.h
 * @Description: 通用头文件，包含一些简化代码的宏定义
 * @version: 1.0
 */
#pragma once

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <time.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

#ifndef SWAP
#define SWAP(_type_, _a_, _b_)\
   _type_ _temp_ = _a_;\
   _a_ = _b_;\
   _b_ = _temp_;
#endif

#ifndef MALLOC
#define MALLOC(_type_, _count_) (_type_*)malloc(sizeof(_type_) * (_count_))
#endif

#ifndef REALLOC
#define REALLOC(_pos_, _type_, _count_) (_type_*)realloc(_pos_, sizeof(_type_) * (_count_))
#endif

#ifndef CALLOC
#define CALLOC(_type_, _count_) (_type_*)calloc(sizeof(_type_), (_count_))
#endif

#ifndef ARRAY_PRINT
#define ARRAY_PRINT(_array_, _array_size_, _type_, _format_) printf("[");\
for (int _i_ = 0; i < _array_size_; _i_++) {\
   printf(_i_ == _array_size_ - 1 ? _format_ : _format_", ", _array_[_i_]);\
}\
printf("]\n");
#endif